// 切换tab栏
const changeTab = (item) => {
  const origin  = window.location.origin
  const url = `${origin}/${item.url}`  
  window.location.replace(url)
}
 
const goLogin = () => {  
  setTimeout(() => {
    window.location.replace('/login.html')
  }, 1000)
  
}

// 检查是否登录
const hasLogin = (originUrl) => {
  fetch(`${originUrl}/getLogin`)
    .then(res => res.json())
    .then(res => {
      if(!res.res.user) {
        goLogin()
      }
    }).catch(() => {
      // goLogin()
    })
}
